﻿<%@ WebHandler Language="C#" Class="性格测试" %>

using System;
using System.Web;
using System.Data.SqlClient;
using System.Web.SessionState;

public class 性格测试 : IHttpHandler,IRequiresSessionState {

    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "text/plain";
        HttpContext.Current.Session["xinhao"] = 0;
        string xm = context.Request["xm"];
        string fs = context.Request["fs"];
        //DateTime dt = new DateTime();
        string dt = DateTime.Now.ToString();
        string sql = "insert 表单 values (@xm,@fs,@shijian)";
        SqlParameter[] ps =
            {
                new SqlParameter("@xm",xm),
                new SqlParameter("@fs",fs),
                new SqlParameter("@shijian",dt)
    };
        int res = sqlhelper.ExecuteNonQuery(sql, ps);
        if (res > 0)
        {
            context.Response.Write("ture");
            HttpContext.Current.Session["xinhao"] = 1;
        }
        else
        {
            context.Response.Write("false");
        }
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}